package caches;
import java.util.concurrent.atomic.AtomicReference;


public class UnsafeCache<K, V> implements Cache<K, V> {
	private final AtomicReference<K> key = new AtomicReference<>();
	private final AtomicReference<V> value = new AtomicReference<>();
	
	public void put(K key, V value) {
		this.key.set(key);
		this.value.set(value);
	}
	
	public V get(K key) {
		if (this.key.get() != null && this.key.get().equals(key))
			return value.get();
		else
			return null;
	}
}
